<template>
  <vui-icon v-if="theme.showRefresh" icon="refresh-line" @click="refreshRoute" />
</template>

<script>
  import { computed, defineComponent } from 'vue'
  import { useStore } from 'vuex'

  export default defineComponent({
    name: 'VuiRefresh',
    setup() {
      const store = useStore()

      const theme = computed(() => store.getters['settings/theme'])

      // const { proxy } = getCurrentInstance()

      const refreshRoute = () => {
        // proxy.$pub('reload-router-view')
        location.reload()
      }

      return {
        theme,
        refreshRoute,
      }
    },
  })
</script>
